
import {userinfo} from '@/api/user.js'
export const mixins = {
	
	data() {
		return {};
	},
	
	mounted() {},
	methods: {
		navto(url) {
			console.log(url)
			uni.navigateTo({
				url
			})
		},
		backhome(){
			uni.switchTab({
				url:'/pages/tabbar/home'
			})
		},
		imgPreview(urls, i) {
			let us = []
			urls.map(t => {
				us.push(t)
			})
			// console.log(us)
			uni.previewImage({
				urls: us,
				current: i
			});
		},
		copy(text){
			let _this=this
			uni.setClipboardData({
				data: text,
				success: function () {
					_this.$u.toast('复制成功')
				}
			});
		},
		checkSame(arr) {
		  for (let i = 0; i < arr.length - 1; i++) {
		    for (let j = i + 1; j < arr.length; j++) {
		      if (arr[i].tel === arr[j].tel) {
		        return j;
		      }
		    }
		  }
		  return false;
		},
		getuserinfo(){
			userinfo().then(res=>{
				uni.stopPullDownRefresh()
				if(res.data.code==200){
					
					uni.setStorageSync('ytbuser',res.data.data)
				}
			})
		},
		prevent(e){}
	},
	computed:{
		URL() {
			return (url) => {
				// if (!url) return require('@/static/logo.png')
				if (url && (url.includes(',') && !url.includes('base64'))) url = url.split(',')[0]
				return url ? ((url.includes('http') || url.includes('data:')) ? url : this.$store.state
					.IMAGE_URL + url) : ''
			}
		},
	}
};